<template lang="html">
  <div class="pageBox pd14">
    <CollectionList :listData="listData" :lastpage="lastPage" @onNextPage="onPage"></CollectionList>
  </div>
</template>

<script>
import CollectionList from "@/components/collection"
import { getCollect } from '@/api/user'
export default {
  components:{
    CollectionList
  },
  data(){
    return {
      listData:[],
      form: {
        page: 1,
        limit: 10
      },
    }
  },
  computed: {
    lastPage() {
      return this.listData.length < this.form.page * this.form.limit
    }
  },
  created() {
    this.getList()
  },
  methods: {
    getList() {
      getCollect(this.form).then(res => {
        this.listData = this.listData.concat(res.page.list || [])
      })
    },
    onPage() {
      this.form.page++;
      this.getList()
    }
  },
}
</script>

<style lang="less" scoped>
</style>
